<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
    <title>Package signup Form a Responsive Widget Template :: w3layouts</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/bootstrap.min.css">
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="${pageContext.request.contextPath}/static/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="${pageContext.request.contextPath}/static/bootstrap.min.js"></script>
</head>
<body>
<br>
<c:if test="${isUpdate == null}">
<form class="form-horizontal" style="width:80%;" action="/newsInfo/addNewsInfo?currentPage=1&pageSize=5" method="post"  enctype="multipart/form-data" >
    <div class="form-group">
        <label for="inputEmail3" class="col-sm-2 control-label">新闻标题</label>
        <div class="col-sm-10">
            <input required type="text" name="title" class="form-control" id="inputEmail3" placeholder="新闻标题">
        </div>
    </div>
    <div class="form-group">
        <label for="inputPassword3" class="col-sm-2 control-label">新闻外部连接</label>
        <div class="col-sm-10">
            <input type="text" name="outLink"class="form-control" id="inputPassword3" placeholder="新闻外部连接">
        </div>
    </div>
    <div class="form-group">
        <label for="inputPassword3" class="col-sm-2 control-label">新闻图片</label>
        <div class="col-sm-10">
            <input type="file" class="form-control"  name="file" id="inputPasswo13rd16" >
        </div>
    </div>
    <div class="form-group">
        <label for="inputPassword3" class="col-sm-2 control-label">新闻内容</label>
        <div class="col-sm-10">
            <textarea required name="content" style="height: 300px" class="form-control" id="inputPassword4" placeholder="新闻内容"></textarea>
            <%--<input type="text" name="content" style="height: 200px" class="form-control" id="inputPassword4" placeholder="新闻内容">--%>
        </div>
    </div>
    <div class="form-group">
        <label for="inputPassword3" class="col-sm-2 control-label">排序号</label>
        <div class="col-sm-10">
            <input type="text" name="seq" class="form-control" id="inputPassword5" placeholder="排序号">
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <div class="checkbox">
                <label>
                    <c:forEach var="category" items="${categoryList}">
                        <span><input type="radio" required value="${category.categoryId}" name="categoryId">${category.title}</span>
                    </c:forEach>
                </label>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <div class="checkbox">
                <label>
                    <%--<input type="radio" value="disabled" name="status"> 删除--%>
                    <input type="radio" disabled value="pushed" name="status"> 发布
                    <input type="radio" checked value="unpush" name="status"> 存档
                </label>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-default" style="width: 100px">添加</button>
        </div>
    </div>
</form>
</c:if>

<c:if test="${isUpdate != null}">
    <form class="form-horizontal" style="width:80%;" action="/newsInfo/updateNewsInfo?currentPage=1&pageSize=5" method="post"  enctype="multipart/form-data" >
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">新闻标题</label>
            <div class="col-sm-10">
                <input required type="text" name="title" value="${newsInfo.title}" class="form-control" id="inputEmail4" >
                <input type="hidden" name="newsId" value="${newsInfo.newsId}">
            </div>
        </div>
        <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">新闻外部连接</label>
            <div class="col-sm-10">
                <input type="text" name="outLink" value="${newsInfo.outLink}" class="form-control" id="inputPassword20">
            </div>
        </div>
        <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">新闻图片</label>
            <div class="col-sm-10">
                <input type="file" class="form-control"  name="file" id="inputPassword16" >
            </div>
        </div>
        <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">新闻内容</label>
            <div class="col-sm-10">
                <textarea required style="height: 200px" name="content" class="form-control" id="inputPassword17" >${newsInfo.content}</textarea>
                <%--<input type="text" style="height: 200px" name="content" value="${newsInfo.content}" class="form-control" id="inputPassword17" >--%>
            </div>
        </div>
        <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">排序号</label>
            <div class="col-sm-10">
                <input type="text" name="seq" value="${newsInfo.seq}" class="form-control" id="inputPassword18">
            </div>
        </div>
        <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">分类</label>
            <div class="col-sm-10">
                <%--<input type="text" name="categoryId" value="${newsInfo.categoryId}" class="form-control" id="inputPassword19">--%>
                <c:forEach var="category" items="${categoryList}">
                    <span><input type="radio" value="${category.categoryId}" <c:if test="${category.categoryId == newsInfo.categoryId}">checked</c:if> name="categoryId">${category.title}</span>
                </c:forEach>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <div class="checkbox">
                    <label>
                        <c:if test="${newsInfo.status=='disabled'}">
                            <input type="radio" value="disabled" name="status" checked> 删除
                            <input type="radio" value="pushed" name="status"> 发布
                            <input type="radio" value="unpush" name="status"> 存档
                        </c:if>
                        <c:if test="${newsInfo.status=='pushed'}">
                            <input type="radio" value="disabled" name="status"> 删除
                            <input type="radio" value="pushed" name="status" checked> 发布
                            <input type="radio" value="pushed" name="status"> 存档
                        </c:if>
                        <c:if test="${newsInfo.status=='unpush'}">
                            <input type="radio" value="disabled" name="status"> 删除
                            <input type="radio" value="pushed" name="status"> 发布
                            <input type="radio" value="unpush" name="status" checked> 存档
                        </c:if>
                    </label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-default" style="width: 100px">修改</button>
            </div>
        </div>
    </form>
</c:if>
<br>

</body>
</html>